#!/usr/bin/env node

const me={},
      log = console.log,
      stdin=process.stdin,
      stdout=process.stdout,
      msg=['name','email','qq','phone'];

let i=0;
//log(msg[i]);//换行输入，不加这一行会先要求输入
stdout.write(msg[i]+':');
stdin.on('data',data=>{
  //log(data);//输出是键值
  // log(data.toString('utf8'));//输出和输入一样
  //me[msg[i]]=data.toString('utf8');//输出的时候有\n
  me[msg[i]]=data.slice(0,data.length-1).toString('utf8');
  i++;
  //log(msg[i]);
  if(i<msg.length){
    stdout.write(msg[i]+':');
  }else{
    log(me);
  }
});

stdin.on("end",()=>{
  log('bye');
})

